package com.li.utils.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

@AllArgsConstructor
@Getter
public enum SerializationTypeEnum {
    JSON((byte) 0x01, "json","JsonSerializer"),
    PROTOSTUFF((byte) 0x02, "protostuff","ProtostuffSerializer"),
    HESSIAN((byte) 0X03, "hessian","HessinSerializer");


    private final byte code;
    private final String name;
    private final String className;

    public static String getName(byte code){
        for(SerializationTypeEnum c:SerializationTypeEnum.values()){
            if(c.getCode()==code){
                return c.name;
            }
        }
        return null;
    }

    public static String getClassName(byte code){
        for(SerializationTypeEnum c:SerializationTypeEnum.values()){
            if(c.getCode()==code){
                return "com.li.serialize."+c.name+"."+c.className;
            }
        }
        return null;
    }
}
